<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<!-- header -->
		<%@ include file="/WEB-INF/views/include/header.jsp"%>
		<style>
			.user_manage{
				background-color: white;
			}
			.container{
				width: 100%;
				position: relative;
			}
			.checkbox_item_header{
				height: 30px;
				display: flex;
				flex-flow: row nowrap;
				align-items: center;
			}
            .checkbox_item_body{
				display: none;
				margin-left: 30px;
			}
			.detail_checkbox{
				height: 30px;
				display: flex;
				flex-flow: row nowrap;
				align-items: center;
			}
			/*点击子事项样式*/
			.open_checkbox{
				background-color: #bae7ff;
				padding: 0 5px;
				color: rgba(0,0,0,.65);
				line-height: 24px;
				text-decoration: none;
				vertical-align: top;
				border-radius: 2px;
				cursor: pointer;
				-webkit-transition: all .3s;
				transition: all .3s;
			}
			/*打开列表三角标*/
			.header_open{
				width: 0;
				height: 0;
				border-width: 5px 0px 5px 5px;
				border-style: solid;
				border-color: transparent transparent transparent #666;
				margin-right: 5px;
			}
			.header_close{
				width: 0;
				height: 0;
				border-width: 5px 5px 0px 5px;
				border-style: solid;
				border-color:#666 transparent transparent transparent ;
				margin-right: 5px;
			}
			/*左侧单位按钮组*/
			.checkbox_bottons{
				display: flex;
				flex-flow: row wrap;
				justify-content: flex-start;
			}
			.ant-btn {
				height: 30px;
				 line-height: 30px;
				margin-right: 5px;
				margin-bottom: 5px;
				 position: relative;
				 display: inline-block;
				 font-weight: 400;
				 white-space: nowrap;
				 text-align: center;
				 background-image: none;
				 border: 1px solid transparent;
				 -webkit-box-shadow: 0 2px 0 rgb(0 0 0 / 2%);
				 box-shadow: 0 2px 0 rgb(0 0 0 / 2%);
				 cursor: pointer;
				 -webkit-transition: all .3s cubic-bezier(.645,.045,.355,1);
				 transition: all .3s cubic-bezier(.645,.045,.355,1);
				 -webkit-user-select: none;
				 -moz-user-select: none;
				 -ms-user-select: none;
				 user-select: none;
				 -ms-touch-action: manipulation;
				 touch-action: manipulation;
				 height: 32px;
				 padding: 0 15px;
				 font-size: 14px;
				 border-radius: 4px;
				 color: rgba(0,0,0,.65);
				 background-color: #fff;
				 border-color: #d9d9d9;
			 }
			.ant-btn-primary {
				color: #fff;
				background-color: #1890ff;
				border-color: #1890ff;
				text-shadow: 0 -1px 0 rgba(0, 0, 0,0.12 );
				-webkit-box-shadow: 0 2px 0 rgba(0, 0, 0 ,0.05);
				box-shadow: 0 2px 0 rgba(0, 0, 0 , 0.05);
			}
			.ant-btn-default{
				color: rgba(0,0,0,0.3);
				background-color: #fff;
				border-color: rgba(0,0,0,0.3);
				text-shadow: 0 -1px 0 rgba(0, 0, 0,0.12 );
				-webkit-box-shadow: 0 2px 0 rgba(0, 0, 0 ,0.05);
				box-shadow: 0 2px 0 rgba(0, 0, 0 , 0.05);
			}
			.ant-btn:before {
				 position: absolute;
				 top: -1px;
				 right: -1px;
				 bottom: -1px;
				 left: -1px;
				 z-index: 1;
				 display: none;
				 background: #fff;
				 border-radius: inherit;
				 opacity: .35;
				 -webkit-transition: opacity .2s;
				 transition: opacity .2s;
				 content: "";
				 pointer-events: none;
			 }
			.ant-btn:hover {
				opacity: 0.8;
			}
			.ant-btn-default:hover{
				color: #1890ff;
				border-color: #1890ff;
			}
			/*弹出框*/
			.popup_add_unit,.popup_add_unittype,.popup_add_user,.popup_add_otherks,.popup_user_chance{
				width: 100%;
				height: 100vh;
				position: fixed;
				background-color: rgba(0,0,0,0.3);
				top: 0;
				left: 0;
				z-index: 999999;
			}
			.popup_container{
				width: 500px;
				background-color: #fff;
				border-radius: 10px;
				position: absolute;
				top: 50%;
				left: 50%;
				transform: translateX(-50%) translateY(-50%);
			}
			.popup_header{
				width: 100%;
				height: 55px;
				line-height: 55px;
				color: rgba(0,0,0,.85);
				font-weight: 500;
				font-size: 16px;
				display: flex;
				flex-flow: row nowrap;
				justify-content: space-between;
				align-items: center;
				padding: 0 20px;
			}
			.close_popup1,.close_popup2,.close_popup3,.table_close_popup4,.close_popup_chanceuser{
				font-size: 20px;
				cursor: pointer;
			}
			.popup_add_unit,.popup_add_unittype,.popup_add_user,.popup_add_otherks,.popup_user_chance{
				display: none;
			}
			.alert{
				margin: 0;
				display: flex;
				flex-flow: row nowrap;
				justify-content: flex-start;
				align-items: center;
				position: relative;
				border-radius: 5px;
				margin-bottom: 10px;
			}
			.alert font{
				position: absolute;
				top: 50%;
				right: 20px;
				transform: translateY(-50%);
			}
			form{
				padding: 30px 0;
				padding-right: 20px;
				padding-bottom: 50px;
			}
			.form-group{
				height: 30px;
				line-height: 30px;
				margin-bottom: 15px;
			}
			.form-group label{
				text-align: right;
			}
			.submits{
				display: flex;
				padding: 10px 30px;
				flex-flow: row nowrap;
				justify-content: flex-end;
			}
			/*右半部分*/
			.content_buttons{
				display: flex;
				flex-flow: row nowrap;
				justify-content: flex-start;
				font-size: 14px;
				position: relative;
				cursor: pointer;
			}
			.content_buttons .content_button{
				width: 100px;
				height: 30px;
				line-height: 30px;
				color: rgba(0,0,0,0.65);
				font-size: 14px;
				transition:all .5s linear;
				margin-right: 30px;
				text-align: center;
			}
			.content_buttons .active{
				color: #1890ff;
			}
			.content_line{
				width: 100px;
				height: 2px;
				position: absolute;
				left: 0;
				bottom: -2px;
				transition:all .5s linear;
				background-color: #1890ff;
			}
			.content_container{
				width: 100%;
				/*height: 1000px;*/
				position: relative;
				/*overflow-x: auto;*/
				overflow: hidden;
				scrollbar-width: none; /* Firefox */
			}
			.content{
				width: 200%;
				display: flex;
				flex-flow: row nowrap;
				justify-content: flex-start;
				/*position: absolute;*/
				/*left: 0;*/
				/*top: 0;*/
			}
			.content_item{
				flex: 1;
			}
			/*表格*/
			/*按钮不可点击*/
			.no_active{
				color: rgba(0,0,0,0.3);
				background-color: rgba(0,0,0,0.05);
				border-color: rgba(0,0,0,0.3);
				text-shadow: 0 -1px 0 rgba(0, 0, 0,0.12 );
				-webkit-box-shadow: 0 2px 0 rgba(0, 0, 0 ,0.05);
				box-shadow: 0 2px 0 rgba(0, 0, 0 , 0.05);
				cursor: not-allowed;
				pointer-events: none;
			}
			.table{
				width: 100%;
				border-collapse: collapse;
				border-radius: 2px;
			}
			.table_body{
				width: 100%;
			}
			.table_tr{
				width: 100%;
				text-align: center;
				display: flex;
				flex-flow: row nowrap;
			}
			.table_th{
				color: rgba(0,0,0,.65);
				font-size: 14px;
				height: 46px;
				line-height: 46px;
				border: 1px solid #f6f6f6;
			}
			.table_td{
				color: rgba(0,0,0,.35);
				font-size: 14px;
				height: 67px;
				line-height: 67px;
				border: 1px solid #f6f6f6;
			}
			.table_th:nth-child(1),.table_td:nth-child(1),.table_th:nth-child(2),.table_td:nth-child(2),.table_th:nth-child(3),.table_td:nth-child(3){
				flex: 1;
			}
			.table_th:nth-child(4),.table_td:nth-child(4){
				flex: 2;
			 }
			.table_operation{
				display: flex;
				line-height: 1;
				/*padding: 10px;*/
				flex-flow: row wrap;
				justify-content: center;
				align-items: center;
				box-sizing: border-box;
				position: relative;
			}
			.newpwd{
				position: absolute;
				right: 30px;
				top: 0;
			}
			.table_operation span{
				color: #1890ff;
				cursor: pointer;
			}
			.table_operation span:hover{
				border-bottom:1px solid #1890ff;
			}
			/*表格弹窗*/
			.otherks_body{
				padding: 30px 0;
				text-align: center;
			}
			.otherks_body_item{
				height: 30px;
				display: flex;
				flex-flow: row nowrap;
				align-items: center;
				padding-left: 100px;
			}
		</style>
	</head>
	<body class="user_manage">
<%--	<%@ include file="/WEB-INF/views/include/dialog.jsp" %>--%>
	<%@ include file="/WEB-INF/views/include/footer.jsp" %>
          <div class="container">
			  <%--新增科室--%>
			  <div class="popup_add_unit">
				  <div class="popup_container">
					  <div class="popup_header">
						  <div>新增科室</div>
						  <div class="close_popup1">x</div>
					  </div>
					  <hr style="background-color: rgba(0,0,0,0.1);margin:0;" />
					  <%--新增单位表单--%>
					  <form id="add_unit_form">
						  <div class="form-group">
							  <label for="add_unit_form1" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">名称:</label>
							  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
								  <input id="add_unit_form1" type="text" class="form-control" placeholder="请输入名称...">
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_unit_form2" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">所属部门:</label>
							  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
								  <input id="add_unit_form2" type="text" disabled class="form-control" placeholder="请输入所属部门...">
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_unit_form3" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">排序:</label>
							  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
								  <input id="add_unit_form3" type="text" class="form-control" placeholder="请输入排序...">
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_unit_form4" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">状态:</label>
							  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
<%--								  <input id="add_unit_form4" type="text" class="form-control" placeholder="请输入状态...">--%>
								  <select id="add_unit_form4">
									  <option value="">请选择</option>
									  <option value="01">未激活</option>
									  <option value="02">正常</option>
									  <option value="03">停用</option>
								  </select>
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_unit_form5" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">分管领导:</label>
							  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
<%--								  <input id="add_unit_form5" type="text" class="form-control" placeholder="请输入分管领导...">--%>
								      <select id="add_unit_form5">
									  </select>
							  </div>
						  </div>
<%--						  <div class="form-group">--%>
<%--							  <label for="add_unit_form6" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">排序:</label>--%>
<%--							  <div class="col-xs-3 col-sm-3 col-md-2 col-lg-2">--%>
<%--								  <input id="add_unit_form6" type="text" class="form-control">--%>
<%--							  </div>--%>
<%--						  </div>--%>
<%--						  <div class="form-group">--%>
<%--							  <label for="add_unit_form7" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">备注:</label>--%>
<%--							  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">--%>
<%--&lt;%&ndash;								  <input id="add_unit_form7" type="email" class="form-control" placeholder="请输入备注...">&ndash;%&gt;--%>
<%--								  	  <textarea id="add_unit_form7" class="form-control" rows="3" placeholder="请输入备注..."></textarea>--%>
<%--							  </div>--%>
<%--						  </div>--%>
					  </form>
					  <hr style="background-color: rgba(0,0,0,0.1);margin:0;" />
					  <div class="submits">
						  <div class="submits_close1 ant-btn ant-btn-default">取消</div>
						  <div class="submits_submit1 ant-btn ant-btn-primary" onclick="addUnit()">提交</div>
					  </div>
				  </div>
			  </div>
			  <%--新增单位分类--%>
			  <div class="popup_add_unittype">
				  <div class="popup_container">
					  <div class="popup_header">
						  <div>新增单位分类</div>
						  <div class="close_popup2">x</div>
					  </div>
					  <hr style="background-color: rgba(0,0,0,0.1);margin:0;" />
					  <%--新增单位分类表单--%>
					  <form id="add_unittype_form">
						  <div class="form-group">
							  <label for="add_unittype_form1" class="col-xs-3 col-sm-3 col-md-2 col-lg-2 control-label">名称:</label>
							  <div class="col-xs-9 col-sm-9 col-md-10 col-lg-10">
								  <input id="add_unittype_form1" type="text" maxlength="30" class="form-control" placeholder="请输入名称...">
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_unittype_form3" class="col-xs-3 col-sm-3 col-md-2 col-lg-2 control-label">电话:</label>
							  <div class="col-xs-9 col-sm-9 col-md-10 col-lg-10">
								  <input id="add_unittype_form3" type="text" onkeyup="this.value = this.value.replace(/[^0-9-]+/,'');"  maxlength="11" class="form-control" placeholder="请输入电话号码...">
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_unittype_form4" class="col-xs-3 col-sm-3 col-md-2 col-lg-2 control-label">传真:</label>
							  <div class="col-xs-9 col-sm-9 col-md-10 col-lg-10">
								  <input id="add_unittype_form4" type="text" maxlength="30" class="form-control" placeholder="请输入传真...">
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_unittype_form5" class="col-xs-3 col-sm-3 col-md-2 col-lg-2 control-label">地址:</label>
							  <div class="col-xs-9 col-sm-9 col-md-10 col-lg-10">
								  <input id="add_unittype_form5" type="text" maxlength="30" class="form-control" placeholder="地址...">
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_unittype_form6" class="col-xs-3 col-sm-3 col-md-2 col-lg-2 control-label">排序:</label>
							  <div class="col-xs-3 col-sm-3 col-md-2 col-lg-2">
								  <input id="add_unittype_form6" type="text" maxlength="30" class="form-control">
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_unittype_form7" class="col-xs-3 col-sm-3 col-md-2 col-lg-2 control-label">备注:</label>
							  <div class="col-xs-9 col-sm-9 col-md-10 col-lg-10">
<%--								  <input id="add_unittype_form7" type="email" class="form-control" placeholder="请输入备注...">--%>
								  <textarea id="add_unittype_form7" class="form-control" rows="3" placeholder="请输入备注..."></textarea>
							  </div>
						  </div>
					  </form>
					  <hr style="background-color: rgba(0,0,0,0.1);margin:0;" />
					  <div class="submits">
						  <div class="submits_close2 ant-btn ant-btn-default">取消</div>
						  <div class="submits_submit2 ant-btn ant-btn-primary">提交</div>
					  </div>
				  </div>
			  </div>
			  <%--新增用户--%>
			  <div class="popup_add_user">
				  <div class="popup_container">
					  <div class="popup_header">
						  <div>新增用户</div>
						  <div class="close_popup3">x</div>
					  </div>
					  <hr style="background-color: rgba(0,0,0,0.1);margin:0;" />
					  <%--新增单位分类表单--%>
					  <form id="add_user_form">
						  <div class="form-group">
							  <label for="add_user_form1" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">姓名:</label>
							  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
								  <input id="add_user_form1" type="text" class="form-control" placeholder="请输入姓名..." maxlength="30">
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_user_form2" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label" maxlength="30">用户名:</label>
							  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
								  <input id="add_user_form2" type="text" class="form-control" maxlength="30" placeholder="请输入用户名...">
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_user_form3" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">密码:</label>
							  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
								  <input id="add_user_form3" type="text" class="form-control" maxlength="30" placeholder="请输入密码...">
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_user_form4" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">手机号码:</label>
							  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
								  <input id="add_user_form4" type="text" onkeyup="this.value = this.value.replace(/[^0-9-]+/,'');"  class="form-control" maxlength="11" placeholder="请输入手机号码...">
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_user_form5" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">角色:</label>
							  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
<%--							  <input id="add_user_form5" type="text" class="form-control" placeholder="请输入角色...">--%>
								  <select id="add_user_form5">
									  <option value="">请选择</option>
									  <option value="01">县领导</option>
									  <option value="02">主要领导</option>
									  <option value="03">分管领导</option>
									  <option value="04">经办人</option>
								  </select>
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_user_form6" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">职务:</label>
							  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
								  <input id="add_user_form6" type="type" class="form-control" maxlength="30" placeholder="请输入职务...">
<%--								  <textarea id="add_user_form7" class="form-control" rows="3" placeholder="请输入备注..."></textarea>--%>
							  </div>
						  </div>
						  <div class="form-group">
							  <label for="add_user_form7" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">用户排序:</label>
							  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
								  <input id="add_user_form7" type="type" class="form-control" maxlength="30" placeholder="请输入用户排序...">
							  </div>
						  </div>
					  </form>
					  <hr style="background-color: rgba(0,0,0,0.1);margin:0;" />
					  <div class="submits">
						  <div class="submits_close3 ant-btn ant-btn-default">取消</div>
						  <div class="submits_submit3 ant-btn ant-btn-primary" onclick="addUser()">提交</div>
					  </div>
				  </div>
			  </div>
			  <div class="row">
				  <div class="col-xs-5 col-sm-5 col-md-5 col-lg-5">
					  <%--对部门进行的操作--%>
					  <div class="checkbox_bottons">
						  <div class="ant-btn ant-btn-primary" id="add_unit">新增科室</div>
						  <div class="ant-btn ant-btn-primary" id="add_unittype" style="display: none;">添加单位分类</div>
						  <div class="ant-btn ant-btn-primary" style="display: none;">导出</div>
						  <div class="ant-btn ant-btn-default" id="delete_unit">批量删除</div>
					  </div>
					  <%--警告框--%>
						  <div class="alert alert-info" id="checkbox_alert" role="alert">当前选择：<span></span> <font id="delete_chance" style="color: #1890ff;display:none;cursor: pointer;">取消选择</font> </div>
					  <%--	 搜索	  --%>
						  <div class="input-group">
							  <input id="searchtext" type="text" class="form-control" placeholder="请输入要搜索的内容...">
							  <span class="input-group-btn">
								  <button onclick="searchUnit()" class="ant-btn ant-btn-default" type="button">搜索</button>
							  </span>
						  </div>
					  <%--部门选项列表--%>
					  <div class="checkbox_list">
					  </div>
				  </div>
				  <div class="col-xs-7 col-sm-7 col-md-7 col-lg-7">
<%--					  <table id="gridTabletab"></table>--%>
<%--					  <!-- jqGrid工具类 -->--%>
<%--					  <div id="gridPagertab"></div>--%>
					  <div class="content_buttons">
						  <div class="content_button active">基本信息</div>
						  <div class="content_button">用户列表</div>
						  <div class="content_line"></div>
					  </div>
					  <hr style="background-color: rgba(0,0,0,0.1);margin:0;" />
					  <div class="content_container">
						  <div class="content">
							  <div class="content_item">
								  <form id="content_item1">
									  <div class="form-group">
										  <label for="item1_1" class="col-xs-3 col-sm-3 col-md-2 col-lg-2 control-label">名称:</label>
										  <div class="col-xs-9 col-sm-9 col-md-10 col-lg-10">
											  <input id="item1_1" type="text" class="form-control" maxlength="30" placeholder="请输入名称...">
										  </div>
									  </div>
<%--									  <div class="form-group">--%>
<%--										  <label for="item1_2" class="col-xs-3 col-sm-3 col-md-2 col-lg-2 control-label">所属部门:</label>--%>
<%--										  <div class="col-xs-9 col-sm-9 col-md-10 col-lg-10">--%>
<%--											  <input id="item1_2" type="email" class="form-control" maxlength="30" placeholder="所属部门...">--%>
<%--										  </div>--%>
<%--									  </div>--%>
									  <div class="form-group">
										  <label for="item1_3" class="col-xs-3 col-sm-3 col-md-2 col-lg-2 control-label">排序:</label>
										  <div class="col-xs-9 col-sm-9 col-md-10 col-lg-10">
											  <input id="item1_3" type="email" class="form-control" maxlength="30"  placeholder="请输入排序...">
										  </div>
									  </div>
									  <div class="form-group">
										  <label for="item1_4" class="col-xs-3 col-sm-3 col-md-2 col-lg-2 control-label">状态:</label>
										  <div class="col-xs-9 col-sm-9 col-md-10 col-lg-10">
												<%--<input id="item1_4" type="email" class="form-control" maxlength="30" placeholder="请输入状态...">--%>
												<select id="item1_4">
													<option value="">请选择</option>
													<option value="01">未激活</option>
													<option value="02">正常</option>
													<option value="03">停用</option>
												</select>
										  </div>
									  </div>
									  <div class="form-group" id="jbxi_item5" style="display: none;">
										  <label for="item1_5" class="col-xs-3 col-sm-3 col-md-2 col-lg-2 control-label">分管领导:</label>
										  <div class="col-xs-9 col-sm-9 col-md-10 col-lg-10">
											  <%--<input id="item1_4" type="email" class="form-control" maxlength="30" placeholder="请输入状态...">--%>
											  <select id="item1_5">
											  </select>
										  </div>
									  </div>
<%--									  <div class="form-group">--%>
<%--										  <label for="item1_5" class="col-xs-3 col-sm-3 col-md-2 col-lg-2 control-label">分管:</label>--%>
<%--										  <div class="col-xs-3 col-sm-3 col-md-2 col-lg-2">--%>
<%--											  <input id="item1_5" type="email" class="form-control" maxlength="30" placeholder="请输入分管领导...">--%>
<%--										  </div>--%>
<%--									  </div>--%>
								  </form>
								  <hr style="background-color: rgba(0,0,0,0.1);margin:0;" />
								  <div class="submits">
									  <div class="submits_submit4 ant-btn ant-btn-primary" onclick="chanceUnit()">提交</div>
								  </div>
							  </div>
							  <div class="content_item">
								  <div id="add_user" class="ant-btn ant-btn-primary no_active" style="margin-top: 20px">+ 添加用户</div>
								  <div class="table">
									  <div class="table_tr">
										  <div class="table_th">用户名</div>
										  <div class="table_th">姓名</div>
										  <div class="table_th">手机号</div>
										  <div class="table_th">操作</div>
									  </div>
									  <div class="table_body">
									  </div>
								  </div>
							  </div>
						  </div>
					  </div>
				  </div>
			  </div>
			  <%--修改用户--%>
				  <div class="popup_user_chance">
					  <div class="popup_container">
						  <div class="popup_header">
							  <div>修改用户</div>
							  <div class="close_popup_chanceuser">x</div>
						  </div>
						  <hr style="background-color: rgba(0,0,0,0.1);margin:0;" />
						  <%--新增单位分类表单--%>
						  <form id="add_user_form">
							  <div class="form-group">
								  <label for="chance_user_form1" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">姓名:</label>
								  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
									  <input id="chance_user_form1" type="text" class="form-control" placeholder="请输入姓名..." maxlength="30">
								  </div>
							  </div>
							  <div class="form-group">
								  <label for="chance_user_form2" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label" maxlength="30" >用户名:</label>
								  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
									  <input id="chance_user_form2" type="text" class="form-control" maxlength="30" placeholder="请输入用户名..." disabled>
								  </div>
							  </div>
<%--							  <div class="form-group">--%>
<%--								  <label for="chance_user_form3" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">密码:</label>--%>
<%--								  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">--%>
<%--									  <input id="chance_user_form3" type="text" class="form-control" maxlength="30" placeholder="请输入密码...">--%>
<%--								  </div>--%>
<%--							  </div>--%>
							  <div class="form-group">
								  <label for="chance_user_form4" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">手机号码:</label>
								  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
									  <input id="chance_user_form4" type="text" onkeyup="this.value = this.value.replace(/[^0-9-]+/,'');"  class="form-control" maxlength="11" placeholder="请输入手机号码...">
								  </div>
							  </div>
							  <div class="form-group">
								  <label for="chance_user_form5" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">角色:</label>
								  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
									  <%--							  <input id="add_user_form5" type="text" class="form-control" placeholder="请输入角色...">--%>
									  <select id="chance_user_form5">
										  <option value="">请选择</option>
										  <option value="01">县领导</option>
										  <option value="02">主要领导</option>
										  <option value="03">分管领导</option>
										  <option value="04">经办人</option>
									  </select>
								  </div>
							  </div>
							  <div class="form-group">
								  <label for="chance_user_form6" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">职务:</label>
								  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
									  <input id="chance_user_form6" type="type" class="form-control" maxlength="30" placeholder="请输入职务...">
									  <%--								  <textarea id="add_user_form7" class="form-control" rows="3" placeholder="请输入备注..."></textarea>--%>
								  </div>
							  </div>
							  <div class="form-group">
								  <label for="chance_user_form7" class="col-xs-4 col-sm-4 col-md-3 col-lg-3 control-label">用户排序:</label>
								  <div class="col-xs-8 col-sm-8 col-md-9 col-lg-9">
									  <input id="chance_user_form7" type="type" class="form-control" maxlength="30" placeholder="请输入用户排序...">
								  </div>
							  </div>
						  </form>
						  <hr style="background-color: rgba(0,0,0,0.1);margin:0;" />
						  <div class="submits">
							  <div class="submits_close_chanceuser ant-btn ant-btn-default">取消</div>
							  <div class="submits_chanceuser ant-btn ant-btn-primary" onclick="chanceUser()">提交</div>
						  </div>
					  </div>
				  </div>
			  <%--添加到其他科室--%>
			  <div class="popup_add_otherks">
				  <div class="popup_container">
					  <div class="popup_header">
						  <div>添加到其他科室</div>
						  <div class="table_close_popup4">x</div>
					  </div>
					  <hr style="background-color: rgba(0,0,0,0.1);margin:0;" />
					  <div class="otherks_body"></div>
					  <hr style="background-color: rgba(0,0,0,0.1);margin:0;" />
					  <div class="submits">
						  <div class="ant-btn ant-btn-primary" onclick="zytjOtherks(1)">确定添加</div>
<%--						  <div class="ant-btn ant-btn-primary" onclick="zytjOtherks(1)">转移到该科室</div>--%>
<%--						  <div class="ant-btn ant-btn-primary" onclick="zytjOtherks(2)">添加到该科室</div>--%>
						  <div class="submits_close_otherks ant-btn ant-btn-default">取消</div>
					  </div>
				  </div>
			  </div>
		  </div>
		  <div></div>

	<script>
		// 全局列表数据
		var listdata = []
		// 当前选中列表index
		var listdataIndex = -1
		// 当前选中列表子项index
		var listdataChildIndex = -1
		// 获取多选列表
		function getCheckboxList(){
			$.ajax({
				url:'/user/deptRoom',
				type:"get",
				dataType:'json',
				async:false,
				success:function (res) {
					listdata = res.data;
					console.log(listdata)
					listBuild(res.data)
				}
			})
		}
		getCheckboxList()
		var chanceUserArr;
		// 获取表格
	   function getTableData(id,tree){
		   $.ajax({
			   url:'/user/getDeptRoomUsers?sysId='+id+"&tree="+tree,
			   type:"get",
			   dataType:'json',
			   async:false,
			   success:function (res) {
			   	if(res.data){
			   		console.log(res.data)
					chanceUserArr = res.data
					tableBuild(res.data)
			   	}else{
					var userhtml = ""
					$(".table_body").html(userhtml)
				}
			   }
		   })
		}
		var checkbox_list = document.querySelector(".checkbox_list")
	   // 判断当前选中是否为一级节点
	   var tjks_tree = false
	   // 选中的一二级节点树id
	   var tree1_sysid = ""
	   var tree2_sysid = ""
		function listBuild(data){
			var checkbox_list_html = ""
			for (var i = 0; i < data.length; i++) {
				var checkbox_list_children_html = ""
				if(data[i].child){
					for (var j = 0; j < data[i].child.length; j++) {
						checkbox_list_children_html +=
								"<div class=\"detail_checkbox\">" +
									"<input style=\"margin-top: 0;cursor: pointer;\" name=\"chance_checkbox\" value="+
									data[i].child[j].sysId+" type=\"checkbox\">"+
									"<span style=\"margin-left: 10px;cursor: pointer;\">"+
									data[i].child[j].name+
									"</span>"+
									"<input type=\"hidden\" value="+data[i].child[j].tree+">"+
								"</div>"
					}
				}
				checkbox_list_html +=
						"<div class=\"checkbox_item\">"+
							"<div class=\"checkbox_item_header\">"+
								"<span style=\"vertical-align: center\" class=\"header_open\"></span>"+
								"<input class=\"checkbox_item_header_input\" style=\"margin-top: 0;vertical-align: center;cursor: pointer;\" value="+ data[i].sysId +"  type=\"checkbox\"> "+
								"<span style=\"vertical-align: center;margin-left: 10px;cursor: pointer;\"   class=\"header_text\">"+data[i].name+"</span>"+
								"<input type=\"hidden\" value="+data[i].tree+">"+
							"</div>"+
							"<div class=\"checkbox_item_body\">"+
								checkbox_list_children_html+
							"</div>"+
						"</div>"
			}
			$(".checkbox_list").html(checkbox_list_html)
			// 是否全选
			var checkbox_item_header_inputs =  document.querySelectorAll(".checkbox_item_header_input")
			var checkbox_item_bodys = document.querySelectorAll(".checkbox_item_body")
			for (let i = 0; i < checkbox_item_header_inputs.length; i++) {
				checkbox_item_header_inputs[i].onchange = function(){
					var ischecked = checkbox_item_header_inputs[i].checked
					var childrens = checkbox_item_bodys[i].children
					if(ischecked){
						for (let j = 0; j < childrens.length ; j++) {
							childrens[j].children[0].checked = true
						}
					}else{
						for (let j = 0; j < childrens.length ; j++) {
							childrens[j].children[0].checked = false
						}
					}
				}
			}
			// 是否显示子选项
			var header_texts = document.querySelectorAll(".header_text")
			var checkbox_item_headers = document.querySelectorAll(".checkbox_item_header")
			var detail_checkboxs = document.querySelectorAll(".detail_checkbox")
			for (let i = 0; i < header_texts.length; i++) {
				header_texts[i].onclick = function () {
					$("#jbxi_item5").css("display","none")
					listdataIndex = i
					for (let j = 0; j < header_texts.length; j++) {
						header_texts[j].className = "header_text"
					}
					for (var j = 0; j < detail_checkboxs.length; j++) {
						detail_checkboxs[j].children[1].className=""
					}
					if(checkbox_item_bodys[i].style.display == "none"){
						checkbox_item_headers[i].children[0].className = "header_close"
						checkbox_item_bodys[i].style.display = "block"
						header_texts[i].className = "header_text open_checkbox"
						$("#add_user").removeClass("no_active")
						$("#checkbox_alert span").html(header_texts[i].parentNode.children[2].innerHTML)
						getTableData(header_texts[i].parentNode.children[1].value,header_texts[i].parentNode.children[3].value)
						tjks_tree = true
						tree1_sysid = header_texts[i].parentNode.children[1].value
						tree2_sysid = ""
						$("#item1_1").val(listdata[listdataIndex].name)
						// $("#item1_2").val(listdata[listdataIndex])
						$("#item1_3").val(listdata[listdataIndex].orderBy)
						$("#item1_4").val(listdata[listdataIndex].state)
						// $("#item1_5").val(listdata[listdataIndex])
					}else{
						checkbox_item_headers[i].children[0].className = "header_open"
						checkbox_item_bodys[i].style.display = "none"
						$("#add_user").addClass("no_active")
						var userhtml = ""
						$(".table_body").html(userhtml)
						$("#checkbox_alert span").html("")
						tjks_tree = false
						tree1_sysid = ""
						tree2_sysid = ""
						$("#item1_1").val("")
						$("#item1_3").val("")
						$("#item1_4").val("")
					}
				}
				header_texts[i].onclick()
			}
			for (let i = 0; i < checkbox_item_headers.length ; i++) {
			}
			// 点击子事项执行的操作
			for (let i = 0; i < detail_checkboxs.length; i++) {
				// 警告框显示内容
				detail_checkboxs[i].onclick = function(){
					tjks_tree = false
					tree2_sysid = detail_checkboxs[i].children[0].value
					for (var k = 0; k < listdata[listdataIndex].child.length; k++) {
						if(listdata[listdataIndex].child[k].sysId == tree2_sysid){
							listdataChildIndex = k;
							break;
						}
					}
					$("#item1_1").val(listdata[listdataIndex].child[listdataChildIndex].name)
					$("#item1_3").val(listdata[listdataIndex].child[listdataChildIndex].orderBy)
					$("#item1_4").val(listdata[listdataIndex].child[listdataChildIndex].state)
					$("#add_user").removeClass("no_active")
					$("#checkbox_alert span").html(detail_checkboxs[i].children[1].innerHTML)
					for (var j = 0; j < detail_checkboxs.length; j++) {
						detail_checkboxs[j].children[1].className=""
					}
					for (let j = 0; j < header_texts.length; j++) {
						header_texts[j].className = "header_text"
					}
					detail_checkboxs[i].children[1].className="open_checkbox"
					$("#delete_chance").css("display","block")
					getTableData(detail_checkboxs[i].children[0].value,detail_checkboxs[i].children[2].value)
					// 二级显示分管领导
					$("#jbxi_item5").css("display","block")
					$.ajax({
						url:'/user/getgfleaders?deptId='+tree1_sysid,
						type:"get",
						contentType:'application/json',
						async:false,
						success:function (res) {
							console.log(res)
							var fgld_html_c = "<option value=\"\">请选择</option>"
							for (var i = 0; i < res.data.length; i++) {
								fgld_html_c += "<option value="+res.data[i].userId+">"+res.data[i].name+"</option>"
							}
							$("#item1_5").html(fgld_html_c)
							$("#item1_5").val(listdata[listdataIndex].child[listdataChildIndex].fgLeader)
						}
					})
				}
			}
		}
		// listbuild(data);
		// 所有选中的单位
		$("input:checkbox[name='chance_checkbox']:checked").each(function(i){
			var arr = []
			arr.push($(this).val())
			console.log(arr)
		});
	   // 搜索
		function searchUnit(){
			if($("#searchtext").val() == ""){
				getCheckboxList()
			}else{
				var  params = {
					// keyWords:encodeURI(encodeURI($("#searchtext").val()))
					keyWords:$("#searchtext").val()
				}
				$.ajax({
					url:'/user/serchData',
					type:"get",
					data:params,
					// contentType:'application/json;charset=UTF-8',
					contentType:'application/x-www-form-urlencoded; charset=UTF-8',
					async:false,
					success:function (res) {
						console.log(res)
						listdata = res.data;
						listBuild(res.data)
					}
				})
			}
		}
		// 添加科室
		function addUnit(){
			let params = {
				deptId:tree1_sysid,
				fgLeader:$("#add_unit_form5").val(),
				roomName:$("#add_unit_form1").val(),
				state:$("#add_unit_form4").val(),
				orderBy:$("#add_unit_form3").val()
			}
			$.ajax({
				url:'/user/addNewRoom',
				type:"post",
				data:JSON.stringify(params),
				contentType:'application/json',
				async:false,
				success:function (res) {
					alert(res.message)
					if(res.code == 200){
						$(".popup_add_unit").css("display","none")
						clearall()
						getCheckboxList()
					}
				}
			})
		}
		// 批量删除
		$("#delete_unit").click(function () {
			// 即将删除单位id数组
			var arr = []
			// 即将删除单位name数组
			var arrname = []
			$("input:checkbox[name='chance_checkbox']:checked").each(function(i){
				arr.push($(this).val())
				arrname.push($(this).next().text())
			});
			if(arr.length == 0){
				alert("请选中至少一个即将要删除的单位!")
			}else{
				var x;
				var r=confirm("当前选中项为"+arrname.join(",")+" 是否确认删除?");
				if (r==true){
					let params = {
						// ids:arr.join(",")
						ids:arr
					}
					$.ajax({
						url:'/user/delRooms',
						type:"post",
						data:JSON.stringify(params),
						contentType:'application/json',
						async:false,
						success:function (res) {
							alert(res.message)
							if(res.code == 200){
								getCheckboxList()
							}
						}
					})
				}
				else{
				}
			}
		})
		// 取消选择
		$("#delete_chance").click(function () {
			$("#checkbox_alert span").html("")
			$("#add_user").addClass("no_active")
			var detail_checkboxs = document.querySelectorAll(".detail_checkbox")
			for (var j = 0; j < detail_checkboxs.length; j++) {
				detail_checkboxs[j].children[1].className=""
			}
			$("#delete_chance").css("display","none")
		})
	</script>
<script>
	// 单位科室内容修改
	function chanceUnit(){
		var params;
		if(tjks_tree){
			params = {
				sysId:tree1_sysid,
				tree:"1",
				orderBy:$("#item1_3").val(),
				state:$("#item1_4").val(),
				name:$("#item1_1").val(),
			}
		}else{
			params = {
				sysId:tree2_sysid,
				tree:"2",
				orderBy:$("#item1_3").val(),
				state:$("#item1_4").val(),
				name:$("#item1_1").val(),
				fgLeader:$("#item1_5").val(),
			}
		}
		console.log(params)
		$.ajax({
			url:'/user/updDeptRoom',
			type:"post",
			data:JSON.stringify(params),
			contentType:'application/json',
			async:false,
			success:function (res) {
				alert(res.message)
			}
		})
	}
	var content_buttons = document.querySelectorAll(".content_button")
	var content_line = document.querySelector(".content_line")
	var content = document.querySelector(".content")
	for (let i = 0; i < content_buttons.length; i++) {
		content_buttons[i].onclick = function () {
			content_line.style.left = ( 130 * i ) + "px"
			// content.style.left = ( -100 * i ) + "%"
			if(i==0){
				content.style.marginLeft = "0%"
			}
			if(i==1){
				content.style.marginLeft = "-100%"
			}
			for (var j = 0; j < content_buttons.length; j++) {
				content_buttons[j].className = "content_button"
			}
			content_buttons[i].className = "content_button active"
		}
	}
	// 创建表格
	function tableBuild(userarr){
		var userhtml = ""
		for (let i = 0; i < userarr.length; i++) {
			userhtml +=
					"<div class=\"table_tr\">"+
						"<div class=\"table_td\">"+ userarr[i].username +"</div>" +
						"<div class=\"table_td\">"+ userarr[i].name +"</div>" +
						"<div class=\"table_td\">"+ userarr[i].mobile +"</div>" +
						"<div class=\"table_td table_operation\">"+
							"<span  onclick=\"chanceUserPwd("+'\''+ userarr[i].userId+'\'' + ")\">重置密码</span>|"+"<span onclick=\"deleteUser("+'\''+userarr[i].name+'\''+','+'\''+userarr[i].userId+'\''+")\">删除</span>|"+"<span onclick=\"chanceUserPopup("+i+")\">修改</span>|"+"<span onclick=\"addOtherks("+'\''+ userarr[i].userId+'\'' + ")\">添加到其他科室</span>"+
							// "<div class=\"input-group newpwd\">"+
							// 	"<input type=\"text\" class=\"form-control\" placeholder=\"请输入新密码...\">"+
							// 	"<span class=\"input-group-btn\">"+
							// 	"<button class=\"ant-btn ant-btn-primary\" type=\"button\">确认重置</button>"+
							// 	"<button class=\"ant-btn ant-btn-default\" type=\"button\">取消</button>"+
							// 	"</span>"+
							// "</div>"+
						"</div>" +
					"</div>"
		}
		$(".table_body").html(userhtml)
	}
	// 重置密码
	function chanceUserPwd(userid){
        var params = {
			userId:userid
		}
		$.ajax({
			url:'/user/resetPwd',
			type:"post",
			data:JSON.stringify(params),
			contentType:'application/json',
			async:false,
			success:function (res) {
				alert(res.message)
			}
		})
	}
	// 添加用户
    function addUser(){
		let params = {
			roomId:tree2_sysid,
			tree:tjks_tree==true?'1':'2',
			name:$("#add_user_form1").val(),
			username:$("#add_user_form2").val(),
			password:$("#add_user_form3").val(),
			mobile:$("#add_user_form4").val(),
			deptId:tree1_sysid,
			roleId:$("#add_user_form5").val(),
			position:$("#add_user_form6").val(),
			userSort:$("#add_user_form7").val(),
		}
		$.ajax({
			url:'/user/addUsers',
			type:"post",
			data:JSON.stringify(params),
			contentType:'application/json',
			async:false,
			success:function (res) {
				alert(res.message)
				if(res.code==200){
					getTableData(tree2_sysid==""?tree1_sysid:tree2_sysid,tjks_tree==false?"2":"1")
					clearall()
					$(".popup_add_user").css("display","none")
				}
			}
		})
	}
	// 移动到其他科室id
	var otherksid = ""
	// 删除科室内人员
	function deleteUser(name,id){
		// console.log(name)
		console.log(id)
		var x;
		var r=confirm(" 是否确认删除用户:"+name+"?");
		if (r==true){
			let params = {
				roomId:tree2_sysid==""?tree1_sysid:tree2_sysid,
				userId:id
			}
			$.ajax({
				url:'/user/delUserRoom',
				type:"post",
				data:JSON.stringify(params),
				contentType:'application/json',
				async:false,
				success:function (res) {
					alert(res.message)
					if(res.code==200){
						getTableData(tree2_sysid==""?tree1_sysid:tree2_sysid,tjks_tree==false?"2":"1")
					}
				}
			})
		}
		else{
		}
	}
	var chanceuserid = ""
	// 修改用户
	function chanceUserPopup(index){
		chanceuserid = chanceUserArr[index].userId
		$("#chance_user_form1").val(chanceUserArr[index].name)
		$("#chance_user_form2").val(chanceUserArr[index].username)
		// $("#chance_user_form3").val(chanceUserArr[index])
		$("#chance_user_form4").val(chanceUserArr[index].mobile)
		$("#chance_user_form5").val(chanceUserArr[index].roleId)
		$("#chance_user_form6").val(chanceUserArr[index].position)
		$("#chance_user_form7").val(chanceUserArr[index].userSort)
		$(".popup_user_chance").css("display","block")
	}
	$(".close_popup_chanceuser").click(function () {
		$(".popup_user_chance").css("display","none")
	})
	$(".submits_close_chanceuser").click(function () {
		var x;
		var r=confirm("是否确认取消当前编辑？");
		if (r==true){
			$(".popup_user_chance").css("display","none")
			clearall()
		}
		else{
		}
	})
	function chanceUser(){
		var params = {
			tree:tjks_tree==false?"2":"1",
			name:$("#chance_user_form1").val(),
			// password:$("#chance_user_form3").val(),
			mobile:$("#chance_user_form4").val(),
			deptId:tree1_sysid,
			roleId:$("#chance_user_form5").val(),
			position:$("#chance_user_form6").val(),
			userId:chanceuserid,
			userSort:$("#chance_user_form7").val(),
		}
		$.ajax({
			url:'/user/updUsers',
			type:"post",
			data:JSON.stringify(params),
			contentType:'application/json',
			async:false,
			success:function (res) {
				alert(res.message)
				if(res.code == 200){
					$(".popup_user_chance").css("display","none")
					getTableData(tree2_sysid==""?tree1_sysid:tree2_sysid,tjks_tree==false?"2":"1")
					clearall()
				}
			}
		})
	}
	// 添加到其他科室
	function addOtherks(data){
		otherksid = data;
		$(".popup_add_otherks").css("display","block")
		var otherks_body_item_html = ""
		if(listdata[listdataIndex].child){
			for (var j = 0; j < listdata[listdataIndex].child.length; j++) {
				otherks_body_item_html +=
						"<div class=\"otherks_body_item\">" +
						"<input style=\"margin-top: 0;cursor: pointer;\" name=\"otherks_checkbox\" value="+
						listdata[listdataIndex].child[j].sysId+" type=\"checkbox\">"+
						"<span style=\"margin-left: 10px;cursor: pointer;\">"+
						listdata[listdataIndex].child[j].name+
						"</span>"+
						"<input type=\"hidden\" value="+ listdata[listdataIndex].child[j].tree+">"+
						"</div>"
			}
		}else{
			otherks_body_item_html = "当前部门暂无科室!"
		}
		$(".otherks_body").html(otherks_body_item_html)
	}
	function zytjOtherks(index){
		let arr = []
		$("input:checkbox[name='otherks_checkbox']:checked").each(function(i){
			arr.push($(this).val())
		});
		let params = {
			// opera:index,
			userId:otherksid,
			roomId:arr.join(",")
		}
		$.ajax({
			url:'/user/addToRoom',
			type:"post",
			data:JSON.stringify(params),
			contentType:'application/json',
			async:false,
			success:function (res) {
				alert(res.message)
			}
		})
	}
	$(".table_close_popup4").click(function () {
		$(".popup_add_otherks").css("display","none")
	})
	$(".submits_close_otherks").click(function () {
		// var x;
		// var r=confirm("是否确认取消当前编辑？");
		// if (r==true){
		// 	$(".popup_add_otherks").css("display","none")
		// 	clearall()
		// }
		// else{
		// }
		$(".popup_add_otherks").css("display","none")
		clearall()
	})
</script>
<%--三个添加弹窗--%>
<script>
	// 打开弹窗
	$("#add_unit").click(function () {
		console.log($("#checkbox_alert span").text())
		if(tjks_tree == false){
			alert("请先选择部门后再添加科室!")
		}else{
			$(".popup_add_unit").css("display","block")
			$("#add_unit_form2").val($("#checkbox_alert span").text())
			// 获取添加科室的分管领导
			$.ajax({
				url:'/user/getgfleaders?deptId='+tree1_sysid,
				type:"get",
				contentType:'application/json',
				async:false,
				success:function (res) {
					var fgld_html = "<option value=\"\">请选择</option>"
					for (var i = 0; i < res.data.length; i++) {
						fgld_html += "<option value="+res.data[i].userId+">"+res.data[i].name+"</option>"
					}
					$("#add_unit_form5").html(fgld_html)
				}
			})
		}
	})
	$("#add_unittype").click(function () {
		$(".popup_add_unittype").css("display","block")
	})
	$("#add_user").click(function () {
		$(".popup_add_user").css("display","block")
	})
	// 关闭弹窗
	$(".close_popup1").click(function () {
		$(".popup_add_unit").css("display","none")
		clearall()
	})
	$(".close_popup2").click(function () {
		$(".popup_add_unittype").css("display","none")
		clearall()
	})
	$(".close_popup3").click(function () {
		$(".popup_add_user").css("display","none")
		clearall()
	})
	$(".submits_close1").click(function () {
		var x;
		var r=confirm("是否确认取消当前编辑？");
		if (r==true){
			$(".popup_add_unit").css("display","none")
			clearall()
		}
		else{
		}
	})
	$(".submits_close2").click(function () {
		var x;
		var r=confirm("是否确认取消当前编辑？");
		if (r==true){
			$(".popup_add_unittype").css("display","none")
			clearall()
		}
		else{
		}
	})
	$(".submits_close3").click(function () {
		var x;
		var r=confirm("是否确认取消当前编辑？");
		if (r==true){
			$(".popup_add_user").css("display","none")
			clearall()
		}
		else{
		}
	})
	// 清除所有input数据
	function clearall(){
		var inputs1 = document.getElementById("add_unit_form").getElementsByTagName("input");
		var inputs2 = document.getElementById("add_unittype_form").getElementsByTagName("input");
		var inputs3 = document.getElementById("add_user_form").getElementsByTagName("input");
		var textareas1 = document.getElementById("add_unit_form").getElementsByTagName("textarea");
		var textareas2 = document.getElementById("add_unittype_form").getElementsByTagName("textarea");
		var textareas3 = document.getElementById("add_user_form").getElementsByTagName("textarea");
		for( let i = 0; i < inputs1.length; i++ ){
			inputs1[i].value = "";
		}
		for( let j = 0; j < inputs2.length; j++ ){
			inputs2[j].value = "";
		}
		for( let k = 0; k < inputs3.length; k++ ){
			inputs3[k].value = "";
		}
		for( let l = 0; l < textareas1.length; l++ ){
			textareas1[l].value = "";
		}
		for( let m = 0; m < textareas2.length; m++ ){
			textareas2[m].value = "";
		}
		for( let n = 0; n < textareas3.length; n++ ){
			textareas3[n].value = "";
		}
	}
</script>
<script>

		var colNamesTab = ['','单号', '任务名称', "事项类型", "办理时限", "状态说明","逾期说明","任务附件"];

		var colModelTab = [
			{name: 'sysId', width: 60, hidden: true, key: true},
			{name: 'sysId', index: 'sysId', width: 250,hidden: true, editable: true},
			{name: 'mainName', index: 'mainName', width: 250, editable: true},
			{name: 'categoryId', index: 'categoryId', width: 250, editable: true, formatter: categoryIdFormatter},
			{name: 'timeLimit', index: 'timeLimit', width: 250, editable: true},
			{name: 'typeExplain', index: 'typeExplain', width: 250, editable: true },
			{name: 'overdueExplain', index: 'overdueExplain', width: 250, editable: true},
			{name: 'file', index: 'file', width: 250, editable: true, formatter: fileFormatter}
		];
     var rowIds;
		jqgrid({
			gridTableId: "#gridTabletab",
			gridPagerId: "#gridPagertab",
			url:'/taskMain/nowMain',
			colNames:colNamesTab,
			colModel:colModelTab,
			rowNum:10,
			postData:{'type':'0','imp':'0'},
			autoScroll: false,
			shrinkToFit: false,
			multiselect:true,
			rownumbers: true,
			onSelectRow: function (rowid, status) {
				var rowIds = rowid;
				//选择当前的行
				var selectedRowValue = $("#gridTabletab").jqGrid('getRowData', rowid);
				var types = selectedRowValue.type;//获取任务状态
				//只有已经反馈和待反馈才可以打开
				if (types == "已反馈") {
					$("#comment").attr("disabled", false);
				} else {
					$("#comment").attr("disabled", true);
				}
				if (!status) {
					gridRemoveSelect(rowid);
				} else {
					var flag = false;
					for (var i = 0; i< rowids.length; i++){
						if(rowids[i] ==  rowid){
							flag = true;
							continue;
						}
					}
					if(!flag){
						gridAddSelect(rowid);
					}
				}
			},
			loadComplete:function (data) {
				var ids = $("#gridTabletab").jqGrid("getDataIDs");
				var rowDatas = $("#gridTabletab").jqGrid("getRowData");//获取所有行的数据
				for (var i = 0; i<rowDatas.length;i++){
					if (data.rows[i].overdueDay){
						$("#"+ids[i]+ " td").css("color","red"); //逾期
					}
				}
			},
			onSelectAll:function (aRowids,status){
				if (!status) {
					aRowids.forEach(function(value,index){
						gridRemoveSelect(value);
					});
				} else {
					aRowids.forEach(function(value,index){
						var flag = false;
						for (var i = 0; i< rowids.length; i++){
							if(rowids[i] ==  value){
								flag = true;
								continue;
							}
						}
						if(!flag){
							gridAddSelect(value);
						}
					});
				}
			},
			gridComplete: function () {
				var rowIds = jQuery("#gridTabletab").jqGrid('getDataIDs');
				for (var k = 0; k < rowIds.length; k++) {
					var flag = false;
					for (var i = 0; i < rowids.length; i++) {
						if (rowids[i] == rowIds[k]) {
							flag = true;
							continue;
						}
					}
					if (flag && flag == true) {
						jQuery("#gridTabletab").setSelection(rowIds[k], true);
					}
				}
			},
			ondblClickRow:function (rowid) {
				// var rowData = $('#gridTabletab').jqGrid('getRowData',rowid).taskUnitId;
				console.log(rowid)
				parent.openapp("/taskMain/query2/"+rowid,rowid,"子任务页面")

			}
		});
		function categoryIdFormatter(data) {
			let mz = '';
			$.ajax({
				url:'/taskMain/categoryName/'+data,
				type:"get",
				dataType:'json',
				async:false,
				success:function (data) {
					mz = data.category;
				}
			})
			return mz;
		}
		function fileFormatter(data) {
			if (data == null || data == "") {
				return "无任务附件";
			} else {
				return '<input type="button" value="下载" onclick="downDetail(\'' + data + '\')" \n' +
						' style="width: 100%; height: 32px;" class="btn-large btn-primary"/>';
			}
		}
	</script>
	</body>
</html>